package yijy.threeCountry;

/**
 * Created by yijy on 2017/5/31.
 */
public class TaskFarmerArmy implements Runnable{
    volatile boolean keeprunning=true;
    public volatile int blood = 100;
    public void run(){
        while (keeprunning){
            for(int i=0;i<5;i++){
                blood--;
                System.out.println(Thread.currentThread().getName()+"进攻对方:"+i+"; blood="+blood);
                Thread.yield();
            }
            keeprunning = false;
        }
        System.out.println(Thread.currentThread().getName()+"结束战斗！");
    }
}
